<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
</head>

<body>
	<?php
            //if (isset($_COOKIE["Studial"]))
            //{
                $ini_array = parse_ini_file("../config1.ini");
				@ $con = mysql_pconnect($ini_array['dblink'], $ini_array['dbuser'], $ini_array['dbpass']);
					
				//$nameCookie = $_COOKIE['Studial'];
				$CourseID = $_GET['CourseID'];
				
				if (!$con)
				{
					die('Could not connect: ' . mysql_error());
				}
				
				@ mysql_set_charset('utf8');
				@ mysql_select_db($ini_array['dbname']);
        
                $result = "SELECT * FROM `works` us INNER JOIN `university` un ON w.university_id = un.id INNER JOIN `courses` c ON c.university_id = un.id INNER JOIN `users` us ON us.id = w.user_id WHERE c.id = '".$CourseID."'";
				
                $result = mysql_query($result) or die('Error, query failed');
				
				$now = getdate();
            //}
            //else
            //{
               	//header('location: ../login/deletecookies.php');
                //exit;
            //}
        ?>

		<h2 align="center" style="color:#CC0000">ALL STUDENTS IN COURSE</h2>
        <table border="1" align="center">
            <tr align="center">
            	<td>Username</td>
                <td>Surname</td>
                <td>Firstname</td>
                <td>Last Access</td>
                <td>Remove</td>
            </tr>
            <?php
				//$nameCookie = $_COOKIE['Studial'];
				
                $numresult = mysql_num_rows($result);
				
                for($i=1; $i<=$numresult; $i++)
                {
                    $row = mysql_fetch_array($result);
					echo "<tr><td>".stripslashes($row['Username'])."</td>";
                    echo "<td>".stripslashes($row['Lastname'])."</td>";
					echo "<td>".stripslashes($row['Firstname'])."</td>";
					echo "<td>".$now."</td>";
					echo "<td><a href="."../removeStudent.php?Username=".stripslashes($row['Username']).">"."Chấp nhận"."</a></td></tr>";
                }
            ?>
        </table>
</body>
</html>